package com.xuan.temper.service.impl;

import com.xuan.temper.entity.ExponentialTemperature;
import com.xuan.temper.dao.ExponentialTemperatureDao;
import com.xuan.temper.service.ExponentialTemperatureService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (ExponentialTemperature)表服务实现类
 *
 * @author makejava
 * @since 2020-08-31 15:41:05
 */
@Service("exponentialTemperatureService")
public class ExponentialTemperatureServiceImpl implements ExponentialTemperatureService {
    @Resource
    private ExponentialTemperatureDao exponentialTemperatureDao;

    /**
     * 通过ID查询单条数据
     *
     * @param
     * @return 实例对象
     */
    @Override
    public ExponentialTemperature load(@Param("stockCode") String stockCode , @Param("todayTime")String todayTime ) {
        return this.exponentialTemperatureDao.load(stockCode,todayTime);
    }

    /**查询指定日期并计算 当天温度
     */
    @Override
    public List<ExponentialTemperature> specifiedCalculation(String name, String startTime, String endTime) {
        return exponentialTemperatureDao.specifiedCalculation(name,startTime,endTime);
    }




    /**
     * 新增数据
     *
     * @param exponentialTemperature 实例对象
     * @return 实例对象
     */
    @Override
    public ExponentialTemperature insert(ExponentialTemperature exponentialTemperature) {
        this.exponentialTemperatureDao.insert(exponentialTemperature);
        return exponentialTemperature;
    }

    /**
     * 修改数据
     *
     * @param exponentialTemperature 实例对象
     * @return 实例对象
     */
    @Override
    public ExponentialTemperature update(ExponentialTemperature exponentialTemperature) {
        this.exponentialTemperatureDao.update(exponentialTemperature);
//        return this.load(exponentialTemperature.getStockCode());
        return null;
    }

    @Override
    public Boolean delete(String time, String stockCode) {
        return exponentialTemperatureDao.delete(time,stockCode);
    }


    @Override
    public Boolean deleteByStock(String stockCode) {
        return exponentialTemperatureDao.deleteByStock(stockCode);
    }

    /**
     * 通过主键删除数据
     *
     * @param
     * @return 是否成功
     */

}
